package com.runrunfast.fxj.enums;

/**
 * @author: 陈胤训
 * @create: 2019-03-13 14:14
 **/
public enum RoleStatusEnum {

    NORMAL(1, "正常"),
    REVIEW(0,"审核"),
    DISABLE(-1, "禁用"),
    ROLE_FAILED(11, "角色操作失败"),
    ROLE_EXIST(11, "角色已经存在"),
    ROLE_NULL(10, "角色不存在");

    private Integer code;
    private String desc;

    RoleStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RoleStatusEnum get(Integer code) {
        if (null == code) {
            return NORMAL;
        }
        RoleStatusEnum[] enums = RoleStatusEnum.values();
        for (RoleStatusEnum anEnum : enums) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return NORMAL;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
